﻿package com.wandian.controller
{
	import com.wandian.data.GameData;
	import com.wandian.model.AccountProxy;
	import com.wandian.model.RoomInfoProxy;
	import com.wandian.model.UserInfoProxy;
	import com.wandian.model.vo.PlayerVo;
	import com.wandian.model.vo.RoomVo;
	import com.wandian.view.mediator.FriendAndRoomPlayerMediator;
	import com.wandian.view.mediator.GameRoomMediator;
	import com.wandian.view.mediator.MaskGameMediator;
	import com.wandian.view.mediator.account.AccountMediator;
	
	import flash.display.MovieClip;
	
	import org.puremvc.as3.interfaces.*;
	import org.puremvc.as3.patterns.command.*;

    public class FriendAndRoomPlayerCommand extends SimpleCommand
    {
        private var _global:GameData;

        public function FriendAndRoomPlayerCommand()
        {
            this._global = GameData.getInstance();
            return;
        }

        override public function execute(notification:INotification) : void
        {
            super.execute(notification);
            var roomInfoProxy:RoomInfoProxy = facade.retrieveProxy(RoomInfoProxy.NAME) as RoomInfoProxy;
            var userInfoProxy:UserInfoProxy = facade.retrieveProxy(UserInfoProxy.NAME) as UserInfoProxy;
            switch(notification.getName())
            {
                case CLZNoticeName.REGISTER_FRIEND_ROOMPLAYER:
                {
                    facade.registerMediator(new FriendAndRoomPlayerMediator(notification.getBody() as MovieClip));
                    break;
                }
                case CLZNoticeName.FRIEND_LIST_REQ:
                {
                    userInfoProxy.requestFriendList();
                    break;
                }
                case CLZNoticeName.SHOW_ROOM_PALYER_LIST_REQ:
                {
                    roomInfoProxy.requestRoomPlayerData(int(notification.getBody()));
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }

    }
}
